<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>판매 글 수정하기</title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="${initParam.root}jquery-1.9.1.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("#sellListBtn").click(function(){
			location.href="${initParam.root }sell.do?command=getContentList&pageNo=1";
			});//list_btn click
		$("#sellDeleteFile").click(function(){
			$.ajax({
				type:"POST",
				url:"${initParam.root }sell.do",
				data:"command=deleteFile&filename=${requestScope.svo.destFileName}",
				dataType:"json",
				success:function(data){
					$("#sellShowUploadFileButton").html("상품사진 : <input type='file' name='uploadFile'> <br>");
				}//success
			});//ajax
		});//deleteFile click
	});//ready
</script>
</head>

<h3>판매 글 수정하기</h3><br>
<form action="${initParam.root }sell.do" method="post" enctype="multipart/form-data">
<input type="hidden" name="command" value="updateContent">
글 번호 : <input type="text" name="sellNo" value=" ${requestScope.svo.sellNo}" readonly>
글 제목 : <input type="text" name="title" value="${requestScope.svo.title}"> <br>
상품명 : <input type="text" name="productName" value="${requestScope.svo.productName}"> <br>

<div id="sellShowUploadFileButton">
<c:choose>
	<c:when test="${requestScope.svo.orgFileName!=null }">
			${requestScope.svo.orgFileName} <input type="button" value="삭제" id="sellDeleteFile"> <br>
	</c:when>
	<c:otherwise>
		상품사진 : <input type="file" name="uploadFile"> <br>
	</c:otherwise>
</c:choose>
</div>
<input type="hidden" name="sellStatus" value="${requestScope.svo.sellStatus}">
<input type="hidden" name="sellContentWriter" value="${requestScope.svo.mvo.id}">
판매단가 : <input type="text" name="productPrice" value="${requestScope.svo.productPrice}"> <br>
판매지역 : <input type="text" name="tradeArea" value="${requestScope.svo.tradeArea}"> <br>
<textarea name="content" rows=20 cols=60>${requestScope.svo.content}</textarea>
<input type="submit" id="sellUpdateBtn" value="판매글 수정">
</form>
<input type="button" id="sellListBtn" value="판매글 목록">

